package com.wyd.principle.DependencyInversion;

public class DependencyInversionDemo02 {
    public static void main(String[] args) {
        User02 user = new User02();
        user.receive(new Email02());
    }
}

/**
 * 抽象
 */
interface message{
    String getMsg();
}

class Email02 implements message{
    public String getMsg() {
        return "Email 信息";
    }
}

/**
 * 依赖抽象
 * 接口 message
 */
class User02{
    public void receive(message msg){
        System.out.println(msg.getMsg());
    }
}

